import { z } from "zod";

export const R_USERNAME = {
  MIN_LENGTH: 4,
  MAX_LENGTH: 16,
  PATTERN: /^[a-zA-Z0-9_-]+$/,
};

// prettier-ignore
export const USERNAME_ZOD = z.string()
  .min(R_USERNAME.MIN_LENGTH, { message: `用户名至少应包含${R_USERNAME.MIN_LENGTH}个字符。` })
  .max(R_USERNAME.MAX_LENGTH, { message: `用户名最多可包含${R_USERNAME.MAX_LENGTH}个字符。` })
  .regex(R_USERNAME.PATTERN);
